﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BusinessObjects.BusinessRules;

namespace BusinessObjects.Sales
{
    public class Invoice : BusinessObject
    {
        public Invoice()
        {
            AddRule(new ValidateRequired("RefID"));

            AddRule(new ValidateRequired("RestaurantID"));

            AddRule(new ValidateRequired("RefNo"));
            AddRule(new ValidateLength("RefNo", 0, 20));

            AddRule(new ValidateRequired("RestaurantTableID"));

            AddRule(new ValidateRequired("EmployeeID"));

            AddRule(new ValidateRequired("AccountingObjectID"));
        }

        public Invoice(string refId, string restaurantId, int refType, DateTime refDate, DateTime postedDate, string refNo, string employeeId,
                            string accountingObjectID, string accountingObjectName, string accountingObjectAddress, string journalMemo,
                            string currencyId, decimal exchangeRate, decimal totalAmount, decimal totalDiscountAmount, decimal totalVATAmount,
                            bool isPosted)
            : this()
        {
            RefID = refId;
            RestaurantID = restaurantId;
            RefType = refType;
            RefDate = refDate;
            PostedDate = postedDate;
            RefNo = refNo;
            EmployeeID = employeeId;
            AccountingObjectID = accountingObjectID;
            AccountingObjectName = accountingObjectName;
            AccountingObjectAddress = accountingObjectAddress;
            JournalMemo = journalMemo;
            CurrencyID = currencyId;
            ExchangeRate = exchangeRate;
            TotalAmount = totalAmount;
            TotalDiscountAmount = totalDiscountAmount;
            TotalVATAmount = totalVATAmount;
            IsPosted = isPosted;
        }

        public string RefID { get; set; }

        public string RestaurantID { get; set; }

        public int RefType { get; set; }

        public DateTime RefDate { get; set; }

        public DateTime PostedDate { get; set; }

        public string RefNo { get; set; }

        public string RestaurantTableID { get; set; }

        public string EmployeeID { get; set; }

        public string AccountingObjectID { get; set; }

        public string AccountingObjectName { get; set; }

        public string AccountingObjectAddress { get; set; }

        public string JournalMemo { get; set; }

        public bool SaleInvoiceAsOutward { get; set; }

        public string CurrencyID { get; set; }

        public decimal ExchangeRate { get; set; }

        public decimal TotalAmount { get; set; }

        public decimal TotalDiscountAmount { get; set; }

        public decimal TotalVATAmount { get; set; }

        public bool IsPosted { get; set; }
    }
}
